
package com.shop.cloud.mall.api.controller;

import com.shop.cloud.common.core.constant.SecurityConstants;
import com.shop.cloud.common.core.util.R;
import com.shop.cloud.common.portal.util.ApiUtil;
import com.shop.cloud.weixin.common.feign.FeignWxQrCodeService;
import com.shop.cloud.weixin.common.dto.MaQrCodeDTO;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import jakarta.servlet.http.HttpServletRequest;

/**
 * 小程序码
 *
 * @author
 * @date 2019-10-25 15:39:39
 */
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/wxmaqrcode")
@Tag(description = "wxmaqrcode", name = "小程序码API")
public class WxMaQrCodeController {

	private final FeignWxQrCodeService feignWxQrCodeService;
	/**
	 * 生成小程序码
	 * @param request
	 * @param maQrCodeDTO
	 * @return
	 */
	@Operation(summary = "生成小程序码")
	@PostMapping("/unlimited")
	public R getUnlimited(HttpServletRequest request, @RequestBody MaQrCodeDTO maQrCodeDTO){
		maQrCodeDTO.setAppId(ApiUtil.getAppId(request));
		return feignWxQrCodeService.getUnlimited(maQrCodeDTO, SecurityConstants.FROM_IN);
	}
}
